<?php
/**
 * @ Fmash Top System
 * @ version: 3.0
 * @ author: i.coffee.smile@mail.com
 * @ date:2011-1-27
 * @ file:tag.php $16
 */
 
include_once 'class_mysql.php';
include_once 'function.php';
include_once 'cookie.php';
include_once 'admin.php';

$sid = incheck($_GET['id']);
$uid = incheck($_COOKIE['UID']);
$username = incheck($_COOKIE['Uname']);

if(isset($sid)){
	//获取评价对象姓名
	$getnamesql = "SELECT `name` FROM `$top_man` WHERE `sid` = '$sid';";
	$result = mysql_query($getnamesql);
	$name = mysql_fetch_row($result);
	$name = $name[0];
	//获取曾经有的评价
	$getTaginfo = "SELECT `tag`,`digg`,`tagid` FROM `$top_man_tag` WHERE `sid` = '$sid' ORDER BY `digg` DESC;"; 
	$getTag = mysql_query($getTaginfo);
	//$info = mysql_fetch_row($getTag);
	//$tag = $info[0];
	//$digg = $info[1];
}elseif(isset($_GET['tid'])){
	$tid = incheck($_GET['tid']);
	$u_sql = "UPDATE `$top_man_tag` SET `digg` = `digg` + '1' WHERE `tagid` = '$tid'";
	mysql_query($u_sql);
	$getsid = "SELECT `sid` FROM `$top_man_tag` WHERE `tagid` = '$tid'"; 
	$r = mysql_query($getsid);
	$s = mysql_fetch_row($r);
	$s = $s[0];
	header("location:show.php?id=$s");
}else{
	header('location:index.php');
}
$en_url = en_now_url();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
  <title>评价页面</title>
	<style type="text/css">
		body { background-color: #DCDCDC; color: #666; text-align: center; font-family: arial, sans-serif; font-size:14px; }
		div.dialog {width: 500px;padding: 20px;margin: 50px auto;}
		h1 { font-size: 24px; letter-spacing:-1px; color: #f69; }
		a1 { background:#fff; color:#f69; padding:8px 15px; margin:20px auto; display:block; width:190px; }
	</style>
</head>
<body>
<div class="dialog">
<h1>您现在要评价<b><?php echo $name;?></b>，她已有的评价是：</h1>
<?php while($info = mysql_fetch_row($getTag)){
	echo "<a href=\"tag.php?tid=".$info[2]."\" style=\"\">".$info[0]."</a>&nbsp;";
	if(isset($_COOKIE['UID'])){
			if(is_admin($_COOKIE['UID'])){
				echo "<a href=\"admin_del.php?class=tag&tid=".$info[2]."&from=".$en_url."\" />&spades;删除&hearts;</a>";
			}
		}
}
?>
    <form id="form" name="form" method="post" action="sumbit_tag.php?id=<?php echo $sid;?>">
      <label>
        <input type="text" name="tag" id="tag" />
      </label>
      <label>
        <input type="submit" name="button" id="button" value="&hearts; 提交评价" />
      </label>
    </form>
    <h5>您可以点击上面的评价代表支持相同观点。</h5>
    <a href="show.php?id=<?php echo $sid;?>" style="a1">&larr;&hearts; 点击返回  </a>
  </div>
</body>
</html>